import logging

import requests
from django.conf import settings
from django.http import JsonResponse, HttpResponse
from django.utils.decorators import method_decorator
from django.views import View
from drf_yasg.utils import swagger_auto_schema
from rest_framework import serializers
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet, GenericViewSet
from .serializers import LoginBodySerializer
from utils.djSwagger import swagger_view

logger = logging.getLogger(__name__)


@method_decorator(name="get",
                  decorator=swagger_view.swagger_auto_schema(
                      operation_summary="用户探针保活接口",
                      tags=["Basic"]))
class HealthzView(APIView):
    def get(self, request, *args, **kwargs):
        return HttpResponse("up")


@method_decorator(name="get",
                  decorator=swagger_view.swagger_auto_schema(
                      operation_summary="获取系统配置参数，主要返回给前端用户路径跳转，鉴权等作用",
                      tags=["Basic"]))
class ConfigView(APIView):
    def get(self, request, *args, **kwargs):
        return JsonResponse({
            "PUBLIC_URI": "http://www.baidu.com",
        })

